host_list = []
hosts = []


class Host:
    def __init__(self, host_name, ip, port):
        self.host_name = host_name
        self.ip = ip
        self.port = port


def load_conf():
    file_path = './ip.txt'
    file = open(file_path, encoding='UTF-8')
    try:
        while True:
            line = file.readline()
            if line == '\n':
                continue
            if line:
                arr = line.split('=')
                arr[1] = arr[1].replace('\n', '')
                host_list.append(arr[1])
            else:
                break
    finally:
        file.close()
    i = 0
    while i < len(host_list):
        hosts.append(Host(host_list[i], host_list[i+1], host_list[i+2]))
        i += 3


if __name__ == '__main__':
    load_conf()
